﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class EditRoom : Form
    {
        public EditRoom()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Multiselect = false,
                CheckFileExists = true,
                CheckPathExists = true,
                ShowReadOnly = false,
                Title = "Room background image",
            };
            ofd.FileOk += backgroundOk;
            ofd.ShowDialog(this);
        }

        void backgroundOk(object sender, CancelEventArgs e)
        {
            OpenFileDialog ofd = sender as OpenFileDialog;
            FileInfo fi = new FileInfo(ofd.FileName);
            this.pictureBox1.Image = Image.FromFile(ofd.FileName);
            this.labelImageName.Text = ofd.SafeFileName;
        }
    }
}
